package com.yuelao.yuelao_backend.controller;

import com.yuelao.yuelao_backend.common.ApiResponse;
import com.yuelao.yuelao_backend.service.LocationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/location")
@Slf4j
public class LocationController {

    @Resource
    private LocationService locationService;

    /**
     * 获取省市区三级联动数据
     * GET /location/data
     * @return 省市区数据
     */
    @GetMapping("/data")
    public ApiResponse<Map<String, Object>> getLocationData() {
        Map<String, Object> data = locationService.getLocationData();
        return ApiResponse.ok(data);
    }
}